//
//  HBGetEveryTypeIncomeParser.m
//  HuoBao
//
//  Created by chaiyanan on 15/12/8.
//  Copyright © 2015年 jinxin. All rights reserved.
//

#import "HBGetEveryTypeIncomeParser.h"
#import "HBGetEveryTypeIncomeInfo.h"

@implementation HBGetEveryTypeIncomeParser

-(ParserResult*)parseResponseDictionary:(NSDictionary *)responseDictionary
{
    LLog(@"responseDictionary:%@",responseDictionary);
    ParserResult* result=[[ParserResult alloc]init];
    NSNumber* codeObject=[responseDictionary objectForKey:Key_Code];
    if (codeObject)
    {
        NSInteger code = [codeObject integerValue];
        result.code = code;
        result.message = [responseDictionary objectForKey:Key_Msg];
        if (code == 0)
        {
            NSDictionary *dataDict = [responseDictionary objectForKey:Key_Data];
            if (dataDict&&[dataDict isKindOfClass:[NSDictionary class]])
            {
                HBGetEveryTypeIncomeInfo *info = [[HBGetEveryTypeIncomeInfo alloc]init];
                info.principalIncome = [DataTypeTranslate numberToString:dataDict[Key_principalIncome]];
                info.userTotalIncome = [DataTypeTranslate numberToString:dataDict[Key_userTotalIncome]];
                info.increaseIncome = [DataTypeTranslate numberToString:dataDict[Key_increaseIncome]];
                info.experienceIncome = [DataTypeTranslate numberToString:dataDict[Key_experienceIncome]];
                
                result.result = info;
            }
            else
            {
                result.code=1;
                result.message=@"服务器数据异常";
            }
        }
        
    }
    else
    {
        result.code=1;
        result.message=@"服务器数据异常";
    }
    
    return result;
}

@end
